<%@ page language="java" import="java.util.*,entity.*,dao.*,dao.impl.*,biz.*,biz.impl.*" pageEncoding="ISO-8859-1"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%
	request.setCharacterEncoding("GBK");
	String userName = request.getParameter("userName");
	String userPass = request.getParameter("userPass");
	String head = request.getParameter("head");
	int gender = Integer.parseInt(request.getParameter("gender"));
	/* UserDao userDao = new UserDaoImpl();
	
	User user = new User();
	user.setUserName(userName);
	user.setUserPass(userPass);
	user.setHead(head);
	user.setGender(gender);
	
	int num = userDao.addUser(user);
 */	
	
	UserBiz userBiz = new UserBizImpl();
	
	User user = userBiz.findUser(userName);
	
	user.setUserName(userName);
	user.setUserPass(userPass);
	user.setHead(head);
	user.setGender(gender);
	
	int num = userBiz.addUser(user);
	
	if(num == 1){
		response.sendRedirect("../index.jsp");
	}else {
		response.sendRedirect("../reg.jsp");
	}
	
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">  
    <title>doReg</title>
  </head>
  <body>
  </body>
</html>
